Repository navigation
fix: Reject deleted override entries, and key each override by the key it is listed under - #259
Conversation
|
bugbot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b3e3725. Configure here.
b3e3725 to
83375f8
Compare
There was a problem hiding this comment.
Stale comment
Automated risk review (dry run): Medium
This PR would not be automatically approved. Human approval required.
Why: OverrideLayer, OverrideSinkImpl, and OverrideFileLoader now reject deleted override entries and remap or reject mismatched keys, which changes SDK evaluation of overrides, all-flags state, and events. That is a bounded but non-trivial behavior change with several interacting pieces, so it is Medium.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
There was a problem hiding this comment.
Risk: medium.
Automated risk review (dry run): Medium
This PR would not be automatically approved. Human approval required.
Why: OverrideLayer, OverrideSinkImpl, and OverrideFileLoader change how flag and segment overrides are applied—rejecting deleted entries and mismatched keys, and re-keying file entries—which is SDK evaluation behavior with a bounded blast radius and tests covering the new paths.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
#599) <!-- TERMAG_PR_BODY_BEGIN --> ## Summary launchdarkly/sdk-specs#288 makes a flag or segment marked as deleted invalid in an override snapshot and in an override file: Requirements 1.1.1.1, 1.2.8.1 and 1.3.6.2. A file that contains one fails the reload in the same way as a malformed file, so the last good overrides stay in effect. Before this change, the SDKs did five different things with such an entry, and no contract test used one. The hot reload group of the flag overrides suite gains four tests, which run in both watching and polling mode: - **file with a deleted flag retains last good overrides** - **file with a deleted segment retains last good overrides** - **file with a deleted flag at startup supplies no overrides until it is corrected** - **file with a deleted segment at startup supplies no overrides until it is corrected** Each file that holds a deleted entry also changes the override of the evaluated flag. An SDK that dropped only the deleted entry, instead of discarding the reload, would serve the changed value and fail the test. The startup tests correct the file afterwards and wait for the correction to take effect. A source that stops after a failed initial load fails them. An entry with `"deleted": false` is an ordinary definition. Every full-flag override in the suite already carries that property, because the harness model serializes it, so no new test covers it. ## Results The `flag overrides` suite, run against each test service: | Test service | Result | |---|---| | go-server-sdk `v7` | all 8 new tests fail: the SDK applies the file and serves the changed value | | go-server-sdk launchdarkly/go-server-sdk#510 | 88 ran, all passed | | js-core launchdarkly/js-core#2187 | 73 ran, all passed | | java-core launchdarkly/java-core#259 | 48 ran, all passed (the test service has no listener capabilities) | | dotnet-core launchdarkly/dotnet-core#404 | 88 ran, all passed | | python-server-sdk launchdarkly/python-server-sdk#574, sync and async services | 88 ran on each, all passed | | ruby-server-sdk launchdarkly/ruby-server-sdk#493 | 88 ran, all passed | All 8 new tests ran on every service; none was skipped. **Related issues** - launchdarkly/sdk-specs#288 <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=Overrides --> <sub>Opened from termag</sub> [SDK-3578](https://launchdarkly.atlassian.net/browse/SDK-3578) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Adds **hot reload contract tests** so override files that include a flag or segment with `"deleted": true` are treated like **malformed reloads**: the SDK must keep the last good overrides (or, at startup, serve **no** overrides until the file is fixed). > > The suite covers **deleted flags and deleted segments** under both **watching and polling** modes, using a new `docWithDeletedEntry` helper that pairs a changed `flagValues` entry with a deleted definition so partial application is detectable. > > After an invalid reload, tests confirm a subsequent valid file still applies normally. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit cfe421d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3578]: https://launchdarkly.atlassian.net/browse/SDK-3578?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
83375f8 to
9374a4b
Compare
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved. Cursor Bugbot completed with no findings, and SDK rules 1–4 are satisfied (not a release PR, allowed author, no disallowed workflow changes), but this override evaluation behavior change is above the low-risk approval threshold, so human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved. Cursor Bugbot completed with no findings, and SDK rules 1–4 are satisfied (not a release PR, allowed author, no disallowed workflow changes), but this override evaluation behavior change is above the low-risk approval threshold, so human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
164ea0f to
7b2ebcf
Compare
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved (SDK rule: low-risk approval threshold). Cursor Bugbot completed with no findings, and SDK rules 1–3 are satisfied (not a release PR, allowed author, no disallowed workflow changes), but this override evaluation behavior change is above the low-risk threshold, so human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot found no issues, but this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
7b2ebcf to
7b6a76c
Compare
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
7b6a76c to
809e6d5
Compare
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
809e6d5 to
baf2070
Compare
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
baf2070 to
2919f67
Compare
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2919f67 to
378a36c
Compare
…or segment The override layer never holds a deleted item (sdk-specs#288, Requirement 1.1.1.1). A snapshot from any source that contains one is rejected as a whole: the layer is unchanged, no flag change listener is notified, and the rejection is logged at Error level with the kind and the key (1.2.8.1). The file override source fails the load of a file that has a flag or segment entry marked as deleted, as for a file that cannot be parsed: the overrides in effect stay, the failure names the file and the key, and the retry applies (1.3.6.2). An entry with "deleted": false is an ordinary definition. The file data source keeps accepting deleted entries.
…listed under another key Evaluation reads an override entry by the key it is listed under, while the all flags state and events report the definition's own key. The file source deserialized each entry of "flags" and "segments" as it was, so an entry with no key property had a null key, which made allFlagsState throw a NullPointerException to the application, and an entry pasted under a new key with its old key property was served under one key and reported under the other. Each entry now takes the key it is listed under, as the Node, Go and Python override sources key it; a key property is optional. The override layer now also rejects a snapshot that lists a flag or segment under a key other than its own, as it rejects one with a deleted item: the sink logs the rejection and the overrides in effect stay. Only a custom override source can supply such a snapshot now. The Python SDK makes the same check, from the review of its port.
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
378a36c to
8aa8b6d
Compare
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
There was a problem hiding this comment.
Risk: medium. Not approved under the low-risk approval threshold (SDK rules 1–3 pass: not a release PR, allowed author, no disallowed workflow changes). Cursor Bugbot was skipped so that signal was not used; this override evaluation behavior change needs human review and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
<!-- TERMAG_PR_BODY_BEGIN --> BEGIN_COMMIT_OVERRIDE feat: Add experimental support for file-based flag overrides fix: Keep flag file content out of the file data source's parse error messages fix: Prevent YAML flag files that are parsed at the same time from returning each other's data fix: Report a YAML flag file value that does not match its explicit tag as invalid data instead of an unexpected exception END_COMMIT_OVERRIDE ## Summary Brings `feat/overrides` into `main`: experimental flag overrides for the server SDK on the FDv2 data system, with a file-based override source. The branch is `feat/overrides` with `main` merged into it; `feat/overrides` itself is unchanged. Every change was reviewed and merged through its own PR against `feat/overrides`: #220, #221, #222, #223, #224, #225 and #259. The shared library changes were released from `main` as `launchdarkly-java-sdk-common` 2.6.0 (#298) and `launchdarkly-java-sdk-internal` 1.15.0 (#299), and the server pins those versions. This PR adds nothing of its own; its diff against `main` is the server SDK only. ## Technical design decisions - The merge of `main` takes `main`'s `lib/shared`, which is the released code. Git merged `EventSummarizerInterface` without a conflict, but into the shape of #219, which breaks summarizers outside the library; the merge keeps the shape of #299. - The changelog entries come from the override block above: the feature, and three fixes to the existing file data source that came with the reload infrastructure in #220. ## Needs your attention - Release Please takes the entries from the override block, not from the title. Edit the block to change them. - The new public APIs say `@since 7.20.0`. The open release PR #296 (7.19.3) becomes 7.20.0 once this merges. <details><summary>Details</summary> - Tested: the server tree is identical to the last #259 head. That head builds against the Maven Central artifacts of common 2.6.0 and internal 1.15.0, its server unit tests pass (2348, with the 72 existing skips), and its CI passed, including the v3.2.0-alpha.21 contract tests. CI on `feat/overrides` after the stack merged passed too. - Merge conflicts: `AggregatedEventSummarizer`, `PerContextEventSummarizer`, `DefaultEventProcessorOutputTest` and `EventSummarizerTest` in `lib/shared/internal`, all resolved to `main`'s version. - The fixes to the existing file data source: parse failures no longer quote file lines or values in the log or the data source status; each YAML parse has its own SnakeYAML instance instead of a shared static one; and a value that SnakeYAML cannot convert to its explicit tag is a parse failure, where it escaped the loader before. [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) </details> <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=java-core task=feature --> <sub>Opened from termag</sub> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Adds **experimental file-based flag overrides** on the FDv2 data system: operators can configure `DataSystemBuilder.overrides(FileOverrides.source()...)` so local JSON/YAML files supply flag and segment definitions that **take precedence** over LaunchDarkly data at read time, without affecting client initialization or data-source status. > > The implementation introduces an **override layer** (`OverrideLayer`, `OverrideOverlayStore`, `OverrideSinkImpl`) wired from `FDv2DataSystem`, a pluggable **`OverrideSource` / `OverrideSink`** API, and a **file override source** with polling or filesystem watching, debounced reloads, duplicate-key handling, and safer JSON/YAML parsing (extension-based format choice, improved error messages, per-parse YAML, tag-mismatch handling). > > **Evaluation and analytics behavior** changes: flags/segments from overrides carry a transient marker; the evaluator propagates **override-affected** through prerequisites and segment reads; `EvalResult` / `EvaluationReason` expose the marker; **individual evaluation events are suppressed** for override-affected results (while summaries can still account for them via the new `EventProcessor` parameter); `allFlagsState` and `isFlagKnown` can use overrides **before the store is initialized**. **Dependency tracking** now merges LaunchDarkly and override-layer edges so flag-change listeners fire when LD updates affect overridden definitions. > > Contract tests register the **`flag-overrides`** capability and map override config in `SdkClientEntity`. Build pins bump `launchdarklyJavaSdkCommon` / `Internal` versions. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 763827f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Update, 2026-12-03
launchdarkly-java-sdk-common2.6.0 andlaunchdarkly-java-sdk-internal1.15.0 are released frommain(feat: Add the overrideAffected indicator to EvaluationReason #298, feat: Count override-affected evaluations separately and send no individual events for them #299), and the pins are unchanged.Update, 2026-12-01
feat/overrides, which hasmainmerged into it again. Frommainit gets the 7.19.0 to 7.19.2 releases,java-sdk-internal1.14.0, and the FDv2 fix that leaves out an empty selector (fix: Clear empty FDv2 selectors in shared protocol handling #261). The v3.2.0-alpha.21 contract tests check that fix, so CI failed three FDv2 streaming tests without it.common2.6.0 andinternal1.15.0 published locally fromfeat/overrides:Update, 2026-11-13
feat/overrides, which now includes feat: Add the overrideAffected indicator to EvaluationReason #218 and feat: Count override-affected evaluations separately and send no individual events for them #219 and hasmainmerged into it. Frommainit gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and thejava-sdk-internal1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes.flagsandsegmentsentry as it was, so an entry with nokeyproperty madeallFlagsState()throw aNullPointerExceptionto the application, and an entry pasted under a new key with its oldkeyproperty was served under one key and reported under the other. I confirmed both with a probe against the stack.keyproperty is optional, andFileOverrides.source()says so.OverrideFileLoaderTest.entryIsKeyedByTheKeyItIsListedUnder(JSON and YAML, flags and segments),LDClientOverridesTest.fileEntryIsServedAndReportedUnderTheKeyItIsListedUnder,OverrideLayerTest.replacementThatListsAnItemUnderAnotherKeyIsRejectedAndTheLayerIsUnchanged(including a definition with no key), andOverrideSinkImplTest.snapshotThatListsAFlagUnderAnotherKeyIsRejected. Removing the keying fails the first two, and removing the layer check fails the other two.commonandinternalpublished locally fromfeat/overrides:Requirements
Related issues
Implements the "reject deleted entries" rule of the flag overrides spec, launchdarkly/sdk-specs#288 (Requirements 1.1.1.1, 1.2.8.1 and 1.3.6.2).
This PR is stacked on #225 (
rlamb/overrides-java-contract-tests) so that the PRs below it do not change. Retarget it when the stack merges.Describe the solution you've provided
Before: a flag or segment entry with
"deleted": truebecame a deleted placeholder. That was true both in an override file and in a snapshot from a custom source. The override layer stored it and the overlay served it, so the key looked absent: the LaunchDarkly definition was hidden from evaluation, from prerequisites and segment reads, and from the all-flags state, and the evaluation was not marked as override-affected.After:
OverrideSink). The override layer never holds a deleted item. If a snapshot contains one, the SDK rejects the whole snapshot. The layer stays unchanged, no flag change listener is notified, and the SDK logs an Error naming the kind and the key, for exampleRejected an override snapshot because flag "f" is marked as deleted; the overrides in effect are unchanged. A deleted item is either the placeholder thatDataKind.deserializeproduces or a model object marked as deleted. The check runs inOverrideLayer.setAllbefore the contents are swapped, andOverrideSinkImpllogs the rejection. TheOverrideSinksignature is unchanged and nothing is thrown to the source.OverrideFileLoaderfails the load when a file has a flag or segment entry marked as deleted, the same way it fails for a file that cannot be parsed. The overrides in effect stay, and the existing retry applies. The failure is logged like other load failures and names the file and the key:Unable to load flags: file /path/overrides.json: flag "f" is marked as deleted; remove the entry to remove its override. The check also fires when the duplicate keys handling would drop the entry, because the file still needs correcting. The source detects this while loading, before it calls the sink."deleted": falseis an ordinary definition and still loads.FileOverrides.source()gains one sentence saying that a file with an entry marked as deleted fails to load and that an override is removed by removing its entry or deleting the file.OverrideSink.setOverridesgains one sentence saying that a snapshot with a deleted flag or segment is rejected. The experimental notice is unchanged on both.The ordinary file data source is unchanged on purpose.
FileDataSourceBaseandFileDataSourceParsingare not modified. Rejecting deleted entries there would be a breaking change, which is planned for a later major version. The check lives only in the override path (OverrideFileLoaderand the override layer). A new test,DataLoaderTest.entriesMarkedAsDeletedStillLoadAsDeletedItems, pins the data source's current behavior: it still loads such entries as deleted items.Tests
OverrideLayerTest:replacementThatContainsADeletedItemIsRejectedAndTheLayerIsUnchangedreplacesdeletedPlaceholderIsStoredAsIs, which pinned the old behavior. It covers the deserialized placeholder and a model object marked as deleted, for both flags and segments.definitionWithDeletedFalseIsStoredis new.OverrideSinkImplTest:snapshotWithADeletedFlagIsRejected,snapshotWithADeletedSegmentIsRejectedandsnapshotWithADeletedItemIsRejectedWhenNothingIsListening. Each checks that the layer is unchanged, that no notification is sent, and that the Error is logged.OverrideFileLoaderTest:flagMarkedAsDeletedFailsTheLoadandsegmentMarkedAsDeletedFailsTheLoadcover JSON and YAML, with the exact message naming the file and the key. AlsoentryMarkedAsDeletedFailsTheLoadEvenWhenItIsADroppedDuplicateandentriesWithDeletedFalseAreOrdinaryDefinitions.FileOverrideSourceTest:flagMarkedAsDeletedFailsTheReloadAndKeepsTheOverridesandsegmentMarkedAsDeletedFailsTheReloadAndKeepsTheOverrides. In each, an in-place edit adds the deleted entry and changes another override. Nothing is supplied, the logged Error names the file and the key, and removing the entry recovers.entriesWithDeletedFalseLoadis also new.DataLoaderTest.entriesMarkedAsDeletedStillLoadAsDeletedItems: the ordinary file data source behavior is pinned as unchanged.How I ran them, on JDK 17 (arm64):
b5deba0) with./gradlew publishToMavenLocal -Pversion=2.6.0 -PskipSigning=trueinlib/shared/common. Internal came from the feat: Count override-affected evaluations separately and send no individual events for them #219 head (0e7744f) with-Pversion=1.13.0inlib/shared/internal.lib/sdk/server, ran the override and file data source classes with./gradlew --max-workers=2 --no-daemon -Dorg.gradle.jvmargs=-Xmx2g test --tests '*Override*' --tests '*.integrations.File*' --tests '*.integrations.DataLoaderTest' --tests '*.integrations.FlagFileParser*' --tests '*.integrations.ClientWithFileDataSourceTest'. Result: 343 tests in 29 classes, 0 failures.testtask (same Gradle options). Result: 2275 tests in 129 classes, 0 failures. The 72 skipped tests are the existing skips inPersistentDataStoreWrapperTest.checkstyleMain checkstyleTest javadoc: passed, with no new Javadoc warnings.deleted: falsetests and the data source pin still pass. With the sink's catch removed, the 3 sink tests fail.Describe alternatives you've considered
Iterabletwice. Checking inOverrideLayer.setAllkeeps it to one pass and makes the layer enforce its own invariant.Opened from termag
SDK-3578
Note
Overview
Strengthens flag/segment override handling so invalid snapshots are rejected instead of partially applied.
Override layer (
OverrideLayer.setAll) now refuses any replacement that includes a deleted flag/segment (placeholder ordeleted: true) or a definition listed under a different key than its ownkey. The prior snapshot stays in place; newDeletedItemException/MismatchedKeyExceptiontypes carry clear messages.Override sink catches those failures, logs an error, and does not notify flag-change listeners.
File override source (
OverrideFileLoader) treats"deleted": trueentries as a load failure (like a parse error), forces eachflags/segmentsentry’skeyto match the map key it’s listed under viakeyedBy, and updates public docs onFileOverridesandOverrideSink. Removing an override is done by deleting the entry or file—not by marking deleted.The ordinary file data source is intentionally unchanged; a new test pins that deleted entries still load there.
Extensive unit/integration tests cover rejection, logging, key consistency in evaluation vs
allFlagsState, and file reload behavior.Reviewed by Cursor Bugbot for commit 7b2ebcf. Bugbot is set up for automated code reviews on this repo. Configure here.